﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerSettings : MonoBehaviour
{
    private AudioSource music;
    private void Awake()
    {
        music = this.GetComponent<AudioSource>();
        //音乐音量本地存储、读取
        if (!PlayerPrefs.HasKey("MusicVolume"))
        {
            PlayerPrefs.SetFloat("MusicVolume", 0.3f);
            PlayerPrefs.Save();
        }
        music.volume = PlayerPrefs.GetFloat("MusicVolume");
        music.Play();
        //音效音量本地存储
        if (!PlayerPrefs.HasKey("EffectsVolume"))
        {
            PlayerPrefs.SetFloat("EffectsVolume", 0.3f);
            PlayerPrefs.Save();
        }
    }

    // Start is called before the first frame update
    private void Start()
    {
        
    }
    // Update is called once per frame
    private void Update()
    {
        
    }
}
